<template>
    <div>
       <div>{{state.num}}</div>
       <button @click="add">++</button>
    </div>
</template>
<script>
import { useStore } from 'vuex';
export default {
  setup(props) {
    const { state,commit  } = useStore();
    // console.log(store);
    console.log(state.num);
    const add = () => { // 数量++的函数
       commit('storeAdd');
    }
    return {
      add,
      state
    }
  }
}
</script>
